import request from '@/utils/request'

//后台统一--请求地址前缀
let urlPrefix = "/sys/member";
// 获取用户信息
export function getInfo(token) {
  return request({
    url: urlPrefix + '/info',
    method: 'get',
    params: { token }
  })
}

// 分页查询用户列表信息
export function getMemberList(searchModel){
  return request({
    url: urlPrefix + '/list',
    method: 'get',
    params:{
      pageNo: searchModel.pageNo,
      pageSize: searchModel.pageSize,
      username: searchModel.username,
      phone: searchModel.phone,
      email: searchModel.email
    }
  });
}


//保存用户
export function saveMember(member){
  return request({
    url: urlPrefix + '',
    method: 'post',
    data: member
  });
}

//获取用户信息
export function getMemberById(id){
  return request({
    url: urlPrefix + `/${id}`,
    method: 'get'
  });
}

//删除用户
export function deleteMemberById(id){
  return request({
    url: urlPrefix + `/${id}`,
    method: 'delete'
  });
}

// 修改用户状态
export function updateMemberStatus(member){
  return request({
    url: urlPrefix + `/updateStatus`,
    method: 'post',
    data: member
  });
}


// 重置密码
export function resetMemberPassword(member){
  return request({
    url: urlPrefix + `/resetPassword`,
    method: 'post',
    data: member
  });
}



